export interface DataSearchQueryItem {
  /**
   * 字段
   */
  field: string;
  /**
   * 操作符
   */
  operator: string;
  /**
   * 值
   */
  value: string;
  /**
   * 值类型
   */
  valueType: "string" | "number" | "boolean";
}
export interface DataSearchOrderItem {
  /**
   * 字段
   */
  field: string;
  /**
   * 操作符
   */
  operator: "asc" | "desc";
}

export interface DataSearchSortable {
  sortDirections: ("ascend" | "descend")[];
}

/**
 * 表格视图列配置
 */
export interface DataSearchColumnConfig {
  field: string;
  title: string;
  width: number;
  fixed?: "left" | "right";
  ellipsis: boolean;
  tooltip?: boolean | Record<string, any>;
  sortable?: DataSearchSortable;
  cellClass: string;
  show: boolean;
}

export interface DataSourceRecord {
  _source: string;
  [key: string]: any;
}

export interface DataSearchResult {
  // 表头
  columns: Array<DataSearchColumnConfig>;
  // 记录
  records: Array<DataSourceRecord>;
  // 总数
  total: number;
  // 原始数据
  source: string;
}

export interface DataSearchProp {
  must: Array<DataSearchQueryItem>;
  should: Array<DataSearchQueryItem>;
  mustNot: Array<DataSearchQueryItem>;
  order: Array<DataSearchOrderItem>;
  index: string;
  pageNum: number;
  pageSize: number;
  /**
   * 索引类型，v6之前必须
   */
  type?: string;
}
